import 'package:flutter/material.dart';
import 'package:qunaimedical/network/http.dart';
import 'package:qunaimedical/values/urls.dart';

/// 关于我们
class AboutUsPage extends StatefulWidget {
  const AboutUsPage({Key key}) : super(key: key);

  @override
  _AboutUsPageState createState() => _AboutUsPageState();
}

class _AboutUsPageState extends State<AboutUsPage> {
  String _content;

  @override
  void initState() {
    super.initState();
    _fetchData();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('关于我们')),
      body: SingleChildScrollView(
        child: Padding(
          padding: const EdgeInsets.all(16.0),
          child: Text(_content ?? ''),
        ),
      ),
    );
  }

  void _fetchData() async {
    var data = await XHttp.get(Urls.ABOUT_US);
    if (data != null) {
      setState(() {
        _content = (data as Map<String, dynamic>)['aboutUsContent'];
      });
    }
  }
}
